class Solution
{
public:
    int maxArea(vector<int>& height)
    {
        int left = 0, right = height.size() - 1;
        int maxv = 0, v = 0;
        while (left < right)
        {
            v = min(height[left], height[right]) * (right - left);
            if (v > maxv) maxv = v;
            if (height[left] < height[right]) left++;
            else right--;
        }
        return maxv;
    }
};